package com.yyfax.common.form;

import android.content.Context;
import android.text.TextUtils;

import com.yyfax.common.toast.CompatToast;

/**
 * Created by fuqiang on 2017/5/4.
 * 公司座机校验
 * Copyright  2017 www.yylending.com. All Rights Reserved.
 */
public class LandLineValidate {
    public static boolean validate(Context context, FormLandLineView formLandLineView, NoticeText noticeText) {
        //如果填写了区号，那么就代表填写的是座机（区号+座机号）;如果没填区号，那么就代表输入的是手机号
        //todo 如果填写的是座机，判断区号的长度和座机号的长度，还有分机号的长度
        if (TextUtils.isEmpty(formLandLineView.getAreaCode()) && formLandLineView.getComPhone().length() != 11) {
			CompatToast.showShortToast(context.getApplicationContext(), noticeText.mExpressionMsg);
            return false;
        }
        if (TextUtils.isEmpty(formLandLineView.getComPhone())) {
			CompatToast.showShortToast(context.getApplicationContext(), noticeText.mEmptyMsg);
            return false;
        }
        return true;
    }
}
